package com.itboye.boyeshoping.ViewUtil;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.itboye.boyeshoping.R;

/**
 * Created by Administrator on 2018/7/5 0005.
 */

public class OneButtonDialog extends Dialog {
    private String content;
    private String buttonText;
    private TextView contentTv,buttonTv;
    public OneButtonDialog(@NonNull Context context) {
        super(context);
    }

    public OneButtonDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);
    }

    protected OneButtonDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    public OneButtonDialog(Context context,String text,String buttontext){
        super(context);
        this.content=text;
        this.buttonText=buttontext;
        initView();
    }

    private void initView() {
        View inflate = LayoutInflater.from(getContext()).inflate(R.layout.dialog_onebutton, null);
        contentTv= (TextView) inflate.findViewById(R.id.contentTV);
        buttonTv= (TextView) inflate.findViewById(R.id.buttonTv);
        contentTv.setText(content);
        buttonTv.setText(buttonText);
        this.setCanceledOnTouchOutside(true);
    }
}
